package Pages;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
import selenium.WebDriverWrapper;
import utils.Log4Test;

/**
 * Created with IntelliJ IDEA.
 * User: admin
 * Date: 07.07.14
 * Time: 20:55
 * To change this template use File | Settings | File Templates.
 */
public class AfterSearchPage extends BasePage{

    public static final By element = By.xpath("//div[@class='g-i-list-title']/a");

    public AfterSearchPage(WebDriverWrapper driver) {
        super(driver);
    }

    public String foundProduct() {
        Log4Test.inMethod("foundProduct");

        WebDriverWait wait = new WebDriverWait(driver,10);
        wait.until(ExpectedConditions.elementToBeClickable(element));
        return driver.findElement(element).getText();
    }

    public void productDetails() {
        driver.findElement(element).click();
    }

}
